import { getaskAndAnswer } from '@/services/modules/questionHandle';
import { IAskAndAnswerItem, IAskAndAnswerList } from '@/utils/questionHandle';
import { makeAutoObservable } from 'mobx';

class Modals {
    constructor() {
        makeAutoObservable(this)
    };

    //问题数据数据列表长度
    questionListLen: number = 0
    //分页
    pageNum: number = 1
    setPAgeNum(e: number) {
        this.pageNum = e
    }
    //类型状态
    type = ""
    setType(type: string) {
        this.type = type
    }
    //仅显示有正确答案
    isRight = ""
    setIsRight(e: boolean) {
        this.isRight = e == true ? "1" : "0"
    }

    //模糊搜索

    title = ""
    questionTitle = ""
    setTitle(e: string) {
        this.title = e
    }
    setQuestionTitle(title: string) {
        this.questionTitle = title
    }

    //批量回答数据
    askAndAnswerList: IAskAndAnswerList[] = []
    askAndAnswerListLen: number = 1
    async getaskAndAnswer(params: IAskAndAnswerItem) {
        let res = await getaskAndAnswer(params);
        if (res.code == 200) {
            this.askAndAnswerList = res.rows
            this.askAndAnswerListLen = res.total
        }
    }
}

export default new Modals